3.1205 \(\int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \, dx\)

Optimal. Leaf size=144 \[ \frac{d \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}-\frac{\left (3 a c^2 d-a d^3+b c^3-3 b c d^2\right ) \log (\cos (e+f x))}{f}-x \left (b d \left (3 c^2-d^2\right )-a \left (c^3-3 c d^2\right )\right )+\frac{(a d+b c) (c+d \tan (e+f x))^2}{2 f}+\frac{b (c+d \tan (e+f x))^3}{3 f} \]

[Out]

-((b*d*(3*c^2 - d^2) - a*(c^3 - 3*c*d^2))*x) - ((b*c^3 + 3*a*c^2*d - 3*b*c*d^2 - a*d^3)*Log[Cos[e + f*x]])/f +
 (d*(2*a*c*d + b*(c^2 - d^2))*Tan[e + f*x])/f + ((b*c + a*d)*(c + d*Tan[e + f*x])^2)/(2*f) + (b*(c + d*Tan[e +
 f*x])^3)/(3*f)

________________________________________________________________________________________

Rubi [A]  time = 0.171434, antiderivative size = 144, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 3, integrand size = 23, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.13, Rules used = {3528, 3525, 3475} \[ \frac{d \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}-\frac{\left (3 a c^2 d-a d^3+b c^3-3 b c d^2\right ) \log (\cos (e+f x))}{f}-x \left (b d \left (3 c^2-d^2\right )-a \left (c^3-3 c d^2\right )\right )+\frac{(a d+b c) (c+d \tan (e+f x))^2}{2 f}+\frac{b (c+d \tan (e+f x))^3}{3 f} \]

Antiderivative was successfully verified.

[In]

Int[(a + b*Tan[e + f*x])*(c + d*Tan[e + f*x])^3,x]

[Out]

-((b*d*(3*c^2 - d^2) - a*(c^3 - 3*c*d^2))*x) - ((b*c^3 + 3*a*c^2*d - 3*b*c*d^2 - a*d^3)*Log[Cos[e + f*x]])/f +
 (d*(2*a*c*d + b*(c^2 - d^2))*Tan[e + f*x])/f + ((b*c + a*d)*(c + d*Tan[e + f*x])^2)/(2*f) + (b*(c + d*Tan[e +
 f*x])^3)/(3*f)

Rule 3528

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(d
*(a + b*Tan[e + f*x])^m)/(f*m), x] + Int[(a + b*Tan[e + f*x])^(m - 1)*Simp[a*c - b*d + (b*c + a*d)*Tan[e + f*x
], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && GtQ[m, 0]

Rule 3525

Int[((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)])*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(a*c - b
*d)*x, x] + (Dist[b*c + a*d, Int[Tan[e + f*x], x], x] + Simp[(b*d*Tan[e + f*x])/f, x]) /; FreeQ[{a, b, c, d, e
, f}, x] && NeQ[b*c - a*d, 0] && NeQ[b*c + a*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int (a+b \tan (e+f x)) (c+d \tan (e+f x))^3 \, dx &=\frac{b (c+d \tan (e+f x))^3}{3 f}+\int (c+d \tan (e+f x))^2 (a c-b d+(b c+a d) \tan (e+f x)) \, dx\\ &=\frac{(b c+a d) (c+d \tan (e+f x))^2}{2 f}+\frac{b (c+d \tan (e+f x))^3}{3 f}+\int (c+d \tan (e+f x)) \left (-2 b c d+a \left (c^2-d^2\right )+\left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)\right ) \, dx\\ &=-\left (b d \left (3 c^2-d^2\right )-a \left (c^3-3 c d^2\right )\right ) x+\frac{d \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac{(b c+a d) (c+d \tan (e+f x))^2}{2 f}+\frac{b (c+d \tan (e+f x))^3}{3 f}+\left (b c^3+3 a c^2 d-3 b c d^2-a d^3\right ) \int \tan (e+f x) \, dx\\ &=-\left (b d \left (3 c^2-d^2\right )-a \left (c^3-3 c d^2\right )\right ) x-\frac{\left (b c^3+3 a c^2 d-3 b c d^2-a d^3\right ) \log (\cos (e+f x))}{f}+\frac{d \left (2 a c d+b \left (c^2-d^2\right )\right ) \tan (e+f x)}{f}+\frac{(b c+a d) (c+d \tan (e+f x))^2}{2 f}+\frac{b (c+d \tan (e+f x))^3}{3 f}\\ \end{align*}

Mathematica [C]  time = 0.980257, size = 130, normalized size = 0.9 \[ \frac{6 d \left (3 a c d+3 b c^2-b d^2\right ) \tan (e+f x)+3 d^2 (a d+3 b c) \tan ^2(e+f x)+3 (b+i a) (c-i d)^3 \log (\tan (e+f x)+i)+3 (b-i a) (c+i d)^3 \log (-\tan (e+f x)+i)+2 b d^3 \tan ^3(e+f x)}{6 f} \]

Antiderivative was successfully verified.

[In]

Integrate[(a + b*Tan[e + f*x])*(c + d*Tan[e + f*x])^3,x]

[Out]

(3*((-I)*a + b)*(c + I*d)^3*Log[I - Tan[e + f*x]] + 3*(I*a + b)*(c - I*d)^3*Log[I + Tan[e + f*x]] + 6*d*(3*b*c
^2 + 3*a*c*d - b*d^2)*Tan[e + f*x] + 3*d^2*(3*b*c + a*d)*Tan[e + f*x]^2 + 2*b*d^3*Tan[e + f*x]^3)/(6*f)

________________________________________________________________________________________

Maple [A]  time = 0.006, size = 247, normalized size = 1.7 \begin{align*}{\frac{b{d}^{3} \left ( \tan \left ( fx+e \right ) \right ) ^{3}}{3\,f}}+{\frac{a \left ( \tan \left ( fx+e \right ) \right ) ^{2}{d}^{3}}{2\,f}}+{\frac{3\, \left ( \tan \left ( fx+e \right ) \right ) ^{2}bc{d}^{2}}{2\,f}}+3\,{\frac{ac\tan \left ( fx+e \right ){d}^{2}}{f}}+3\,{\frac{b{c}^{2}d\tan \left ( fx+e \right ) }{f}}-{\frac{b{d}^{3}\tan \left ( fx+e \right ) }{f}}+{\frac{3\,a\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){c}^{2}d}{2\,f}}-{\frac{a\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ){d}^{3}}{2\,f}}+{\frac{\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) b{c}^{3}}{2\,f}}-{\frac{3\,\ln \left ( 1+ \left ( \tan \left ( fx+e \right ) \right ) ^{2} \right ) bc{d}^{2}}{2\,f}}+{\frac{a\arctan \left ( \tan \left ( fx+e \right ) \right ){c}^{3}}{f}}-3\,{\frac{a\arctan \left ( \tan \left ( fx+e \right ) \right ) c{d}^{2}}{f}}-3\,{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) b{c}^{2}d}{f}}+{\frac{\arctan \left ( \tan \left ( fx+e \right ) \right ) b{d}^{3}}{f}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3,x)

[Out]

1/3/f*b*d^3*tan(f*x+e)^3+1/2/f*a*tan(f*x+e)^2*d^3+3/2/f*tan(f*x+e)^2*b*c*d^2+3/f*a*tan(f*x+e)*c*d^2+3/f*b*c^2*
d*tan(f*x+e)-1/f*b*d^3*tan(f*x+e)+3/2/f*a*ln(1+tan(f*x+e)^2)*c^2*d-1/2/f*a*ln(1+tan(f*x+e)^2)*d^3+1/2/f*ln(1+t
an(f*x+e)^2)*b*c^3-3/2/f*ln(1+tan(f*x+e)^2)*b*c*d^2+1/f*a*arctan(tan(f*x+e))*c^3-3/f*a*arctan(tan(f*x+e))*c*d^
2-3/f*arctan(tan(f*x+e))*b*c^2*d+1/f*arctan(tan(f*x+e))*b*d^3

________________________________________________________________________________________

Maxima [A]  time = 1.7049, size = 193, normalized size = 1.34 \begin{align*} \frac{2 \, b d^{3} \tan \left (f x + e\right )^{3} + 3 \,{\left (3 \, b c d^{2} + a d^{3}\right )} \tan \left (f x + e\right )^{2} + 6 \,{\left (a c^{3} - 3 \, b c^{2} d - 3 \, a c d^{2} + b d^{3}\right )}{\left (f x + e\right )} + 3 \,{\left (b c^{3} + 3 \, a c^{2} d - 3 \, b c d^{2} - a d^{3}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right ) + 6 \,{\left (3 \, b c^{2} d + 3 \, a c d^{2} - b d^{3}\right )} \tan \left (f x + e\right )}{6 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3,x, algorithm="maxima")

[Out]

1/6*(2*b*d^3*tan(f*x + e)^3 + 3*(3*b*c*d^2 + a*d^3)*tan(f*x + e)^2 + 6*(a*c^3 - 3*b*c^2*d - 3*a*c*d^2 + b*d^3)
*(f*x + e) + 3*(b*c^3 + 3*a*c^2*d - 3*b*c*d^2 - a*d^3)*log(tan(f*x + e)^2 + 1) + 6*(3*b*c^2*d + 3*a*c*d^2 - b*
d^3)*tan(f*x + e))/f

________________________________________________________________________________________

Fricas [A]  time = 1.45595, size = 324, normalized size = 2.25 \begin{align*} \frac{2 \, b d^{3} \tan \left (f x + e\right )^{3} + 6 \,{\left (a c^{3} - 3 \, b c^{2} d - 3 \, a c d^{2} + b d^{3}\right )} f x + 3 \,{\left (3 \, b c d^{2} + a d^{3}\right )} \tan \left (f x + e\right )^{2} - 3 \,{\left (b c^{3} + 3 \, a c^{2} d - 3 \, b c d^{2} - a d^{3}\right )} \log \left (\frac{1}{\tan \left (f x + e\right )^{2} + 1}\right ) + 6 \,{\left (3 \, b c^{2} d + 3 \, a c d^{2} - b d^{3}\right )} \tan \left (f x + e\right )}{6 \, f} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3,x, algorithm="fricas")

[Out]

1/6*(2*b*d^3*tan(f*x + e)^3 + 6*(a*c^3 - 3*b*c^2*d - 3*a*c*d^2 + b*d^3)*f*x + 3*(3*b*c*d^2 + a*d^3)*tan(f*x +
e)^2 - 3*(b*c^3 + 3*a*c^2*d - 3*b*c*d^2 - a*d^3)*log(1/(tan(f*x + e)^2 + 1)) + 6*(3*b*c^2*d + 3*a*c*d^2 - b*d^
3)*tan(f*x + e))/f

________________________________________________________________________________________

Sympy [A]  time = 0.598733, size = 240, normalized size = 1.67 \begin{align*} \begin{cases} a c^{3} x + \frac{3 a c^{2} d \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 3 a c d^{2} x + \frac{3 a c d^{2} \tan{\left (e + f x \right )}}{f} - \frac{a d^{3} \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{a d^{3} \tan ^{2}{\left (e + f x \right )}}{2 f} + \frac{b c^{3} \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} - 3 b c^{2} d x + \frac{3 b c^{2} d \tan{\left (e + f x \right )}}{f} - \frac{3 b c d^{2} \log{\left (\tan ^{2}{\left (e + f x \right )} + 1 \right )}}{2 f} + \frac{3 b c d^{2} \tan ^{2}{\left (e + f x \right )}}{2 f} + b d^{3} x + \frac{b d^{3} \tan ^{3}{\left (e + f x \right )}}{3 f} - \frac{b d^{3} \tan{\left (e + f x \right )}}{f} & \text{for}\: f \neq 0 \\x \left (a + b \tan{\left (e \right )}\right ) \left (c + d \tan{\left (e \right )}\right )^{3} & \text{otherwise} \end{cases} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))**3,x)

[Out]

Piecewise((a*c**3*x + 3*a*c**2*d*log(tan(e + f*x)**2 + 1)/(2*f) - 3*a*c*d**2*x + 3*a*c*d**2*tan(e + f*x)/f - a
*d**3*log(tan(e + f*x)**2 + 1)/(2*f) + a*d**3*tan(e + f*x)**2/(2*f) + b*c**3*log(tan(e + f*x)**2 + 1)/(2*f) -
3*b*c**2*d*x + 3*b*c**2*d*tan(e + f*x)/f - 3*b*c*d**2*log(tan(e + f*x)**2 + 1)/(2*f) + 3*b*c*d**2*tan(e + f*x)
**2/(2*f) + b*d**3*x + b*d**3*tan(e + f*x)**3/(3*f) - b*d**3*tan(e + f*x)/f, Ne(f, 0)), (x*(a + b*tan(e))*(c +
 d*tan(e))**3, True))

________________________________________________________________________________________

Giac [B]  time = 3.57701, size = 2762, normalized size = 19.18 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((a+b*tan(f*x+e))*(c+d*tan(f*x+e))^3,x, algorithm="giac")

[Out]

1/6*(6*a*c^3*f*x*tan(f*x)^3*tan(e)^3 - 18*b*c^2*d*f*x*tan(f*x)^3*tan(e)^3 - 18*a*c*d^2*f*x*tan(f*x)^3*tan(e)^3
 + 6*b*d^3*f*x*tan(f*x)^3*tan(e)^3 - 3*b*c^3*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) +
 tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^3*tan(e)^3 - 9*a*c^2*d*log(4*(tan(e)^2 +
1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan
(f*x)^3*tan(e)^3 + 9*b*c*d^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(
e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^3*tan(e)^3 + 3*a*d^3*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan
(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^3*tan(e)^3 -
 18*a*c^3*f*x*tan(f*x)^2*tan(e)^2 + 54*b*c^2*d*f*x*tan(f*x)^2*tan(e)^2 + 54*a*c*d^2*f*x*tan(f*x)^2*tan(e)^2 -
18*b*d^3*f*x*tan(f*x)^2*tan(e)^2 + 9*b*c*d^2*tan(f*x)^3*tan(e)^3 + 3*a*d^3*tan(f*x)^3*tan(e)^3 + 9*b*c^3*log(4
*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan
(e) + 1))*tan(f*x)^2*tan(e)^2 + 27*a*c^2*d*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + t
an(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^2 - 27*b*c*d^2*log(4*(tan(e)^2 + 1
)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(
f*x)^2*tan(e)^2 - 9*a*d^3*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^
2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)^2*tan(e)^2 - 18*b*c^2*d*tan(f*x)^3*tan(e)^2 - 18*a*c*d^2*tan
(f*x)^3*tan(e)^2 + 6*b*d^3*tan(f*x)^3*tan(e)^2 - 18*b*c^2*d*tan(f*x)^2*tan(e)^3 - 18*a*c*d^2*tan(f*x)^2*tan(e)
^3 + 6*b*d^3*tan(f*x)^2*tan(e)^3 + 18*a*c^3*f*x*tan(f*x)*tan(e) - 54*b*c^2*d*f*x*tan(f*x)*tan(e) - 54*a*c*d^2*
f*x*tan(f*x)*tan(e) + 18*b*d^3*f*x*tan(f*x)*tan(e) + 9*b*c*d^2*tan(f*x)^3*tan(e) + 3*a*d^3*tan(f*x)^3*tan(e) -
 9*b*c*d^2*tan(f*x)^2*tan(e)^2 - 3*a*d^3*tan(f*x)^2*tan(e)^2 + 9*b*c*d^2*tan(f*x)*tan(e)^3 + 3*a*d^3*tan(f*x)*
tan(e)^3 - 2*b*d^3*tan(f*x)^3 - 9*b*c^3*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(
f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) - 27*a*c^2*d*log(4*(tan(e)^2 + 1)/(tan(
f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*ta
n(e) + 27*b*c*d^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(
f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) + 9*a*d^3*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f
*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1))*tan(f*x)*tan(e) + 36*b*c^2*d*tan(f*x
)^2*tan(e) + 36*a*c*d^2*tan(f*x)^2*tan(e) - 18*b*d^3*tan(f*x)^2*tan(e) + 36*b*c^2*d*tan(f*x)*tan(e)^2 + 36*a*c
*d^2*tan(f*x)*tan(e)^2 - 18*b*d^3*tan(f*x)*tan(e)^2 - 2*b*d^3*tan(e)^3 - 6*a*c^3*f*x + 18*b*c^2*d*f*x + 18*a*c
*d^2*f*x - 6*b*d^3*f*x - 9*b*c*d^2*tan(f*x)^2 - 3*a*d^3*tan(f*x)^2 + 9*b*c*d^2*tan(f*x)*tan(e) + 3*a*d^3*tan(f
*x)*tan(e) - 9*b*c*d^2*tan(e)^2 - 3*a*d^3*tan(e)^2 + 3*b*c^3*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan
(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) + 9*a*c^2*d*log(4*(tan(e)^2 + 1)/(
tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) - 9*b*c
*d^2*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan(e)^2 + tan(f*x)^2 - 2*ta
n(f*x)*tan(e) + 1)) - 3*a*d^3*log(4*(tan(e)^2 + 1)/(tan(f*x)^4*tan(e)^2 - 2*tan(f*x)^3*tan(e) + tan(f*x)^2*tan
(e)^2 + tan(f*x)^2 - 2*tan(f*x)*tan(e) + 1)) - 18*b*c^2*d*tan(f*x) - 18*a*c*d^2*tan(f*x) + 6*b*d^3*tan(f*x) -
18*b*c^2*d*tan(e) - 18*a*c*d^2*tan(e) + 6*b*d^3*tan(e) - 9*b*c*d^2 - 3*a*d^3)/(f*tan(f*x)^3*tan(e)^3 - 3*f*tan
(f*x)^2*tan(e)^2 + 3*f*tan(f*x)*tan(e) - f)